package main.Q401_500;

public class Q481_490 {
    public static void main(String[] args) {
        System.out.println("Question481：");
        System.out.println("Question482：密钥格式化");
        System.out.println("Question483：");
        System.out.println("Question484：");
        System.out.println("Question485：最大连续1的个数");
        System.out.println("Question486：");
        System.out.println("Question487：");
        System.out.println("Question488：");
        System.out.println("Question489：");
        System.out.println("Question490：");
    }
}

class Question482{
    public static String licenseKeyFormatting(String s, int k) {
        StringBuffer stringBuffer=new StringBuffer();
        char[] str=s.toCharArray();
        int count=0;
        for (int i=str.length-1;i>=0;i--){
            if (str[i]=='-') continue;
            else {
                if (count%k==0){
                    stringBuffer.append('-');
                    if (str[i]>='a'&&str[i]<='z') stringBuffer.append((char)(str[i]-32));
                    else stringBuffer.append(str[i]);
                }else {
                    if (str[i]>='a'&&str[i]<='z') stringBuffer.append((char)(str[i]-32));
                    else stringBuffer.append(str[i]);
                }
                count++;
            }
        }
        if (stringBuffer.length()>0) stringBuffer.reverse().deleteCharAt(stringBuffer.length()-1);
        return stringBuffer.toString();
    }
}

class Question485{
    public static int findMaxConsecutiveOnes(int[] nums) {
        int maxlength=0,length=0;
        for (int i=0;i< nums.length;i++){
            if (nums[i]==0){
                if (maxlength<length) maxlength=length;
                length=0;
            }else length++;
        }
        if (maxlength<length) maxlength=length;
        return maxlength;
    }
}